\doxysection{x\+Queue\+Send\+From\+ISR }
\hypertarget{group__x_queue_send_from_i_s_r}{}\label{group__x_queue_send_from_i_s_r}\index{xQueueSendFromISR@{xQueueSendFromISR}}
queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSendToFrontFromISR(                                      QueueHandle\_t xQueue,                                      const void *pvItemToQueue,                                      BaseType\_t *pxHigherPriorityTaskWoken                                   );
\end{DoxyPre}


This is a macro that calls x\+Queue\+Generic\+Send\+From\+ISR().

Post an item to the front of a queue. It is safe to use this macro from within an interrupt service routine.

Items are queued by copy not reference so it is preferable to only queue small items, especially when called from an ISR. In most cases it would be preferable to store a pointer to the item being queued.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em px\+Higher\+Priority\+Task\+Woken} & x\+Queue\+Send\+To\+Front\+From\+ISR() will set \texorpdfstring{$\ast$}{*}px\+Higher\+Priority\+Task\+Woken to pd\+TRUE if sending to the queue caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If x\+Queue\+Send\+To\+From\+From\+ISR() sets this value to pd\+TRUE then a context switch should be requested before the interrupt is exited.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the data was successfully sent to the queue, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage for buffered IO (where the ISR can obtain more than one value per call)\+: 
\begin{DoxyPre}
void vBufferISR( void )
\{
char cIn;
BaseType\_t xHigherPrioritTaskWoken;

   // We have not woken a task at the start of the ISR.
   xHigherPriorityTaskWoken = pdFALSE;

   // Loop until the buffer is empty.
   do
   \{
    // Obtain a byte from the buffer.
    cIn = portINPUT\_BYTE( RX\_REGISTER\_ADDRESS );

    // Post the byte.
    xQueueSendToFrontFromISR( xRxQueue, \&cIn, \&xHigherPriorityTaskWoken );

   \} while( portINPUT\_BYTE( BUFFER\_COUNT ) );

   // Now the buffer is empty we can switch context if necessary.
   if( xHigherPriorityTaskWoken )
   \{
    taskYIELD ();
   \}
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSendToBackFromISR(                                      QueueHandle\_t xQueue,                                      const void *pvItemToQueue,                                      BaseType\_t *pxHigherPriorityTaskWoken                                   );
\end{DoxyPre}


This is a macro that calls x\+Queue\+Generic\+Send\+From\+ISR().

Post an item to the back of a queue. It is safe to use this macro from within an interrupt service routine.

Items are queued by copy not reference so it is preferable to only queue small items, especially when called from an ISR. In most cases it would be preferable to store a pointer to the item being queued.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em px\+Higher\+Priority\+Task\+Woken} & x\+Queue\+Send\+To\+Back\+From\+ISR() will set \texorpdfstring{$\ast$}{*}px\+Higher\+Priority\+Task\+Woken to pd\+TRUE if sending to the queue caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If x\+Queue\+Send\+To\+Back\+From\+ISR() sets this value to pd\+TRUE then a context switch should be requested before the interrupt is exited.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the data was successfully sent to the queue, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage for buffered IO (where the ISR can obtain more than one value per call)\+: 
\begin{DoxyPre}
void vBufferISR( void )
\{
char cIn;
BaseType\_t xHigherPriorityTaskWoken;

   // We have not woken a task at the start of the ISR.
   xHigherPriorityTaskWoken = pdFALSE;

   // Loop until the buffer is empty.
   do
   \{
    // Obtain a byte from the buffer.
    cIn = portINPUT\_BYTE( RX\_REGISTER\_ADDRESS );

    // Post the byte.
    xQueueSendToBackFromISR( xRxQueue, \&cIn, \&xHigherPriorityTaskWoken );

   \} while( portINPUT\_BYTE( BUFFER\_COUNT ) );

   // Now the buffer is empty we can switch context if necessary.
   if( xHigherPriorityTaskWoken )
   \{
    taskYIELD ();
   \}
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSendFromISR(                                  QueueHandle\_t xQueue,                                  const void *pvItemToQueue,                                  BaseType\_t *pxHigherPriorityTaskWoken                             );
\end{DoxyPre}


This is a macro that calls x\+Queue\+Generic\+Send\+From\+ISR(). It is included for backward compatibility with versions of Free\+RTOS.\+org that did not include the x\+Queue\+Send\+To\+Back\+From\+ISR() and x\+Queue\+Send\+To\+Front\+From\+ISR() macros.

Post an item to the back of a queue. It is safe to use this function from within an interrupt service routine.

Items are queued by copy not reference so it is preferable to only queue small items, especially when called from an ISR. In most cases it would be preferable to store a pointer to the item being queued.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em px\+Higher\+Priority\+Task\+Woken} & x\+Queue\+Send\+From\+ISR() will set \texorpdfstring{$\ast$}{*}px\+Higher\+Priority\+Task\+Woken to pd\+TRUE if sending to the queue caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If x\+Queue\+Send\+From\+ISR() sets this value to pd\+TRUE then a context switch should be requested before the interrupt is exited.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the data was successfully sent to the queue, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage for buffered IO (where the ISR can obtain more than one value per call)\+: 
\begin{DoxyPre}
void vBufferISR( void )
\{
char cIn;
BaseType\_t xHigherPriorityTaskWoken;

   // We have not woken a task at the start of the ISR.
   xHigherPriorityTaskWoken = pdFALSE;

   // Loop until the buffer is empty.
   do
   \{
    // Obtain a byte from the buffer.
    cIn = portINPUT\_BYTE( RX\_REGISTER\_ADDRESS );

    // Post the byte.
    xQueueSendFromISR( xRxQueue, \&cIn, \&xHigherPriorityTaskWoken );

   \} while( portINPUT\_BYTE( BUFFER\_COUNT ) );

   // Now the buffer is empty we can switch context if necessary.
   if( xHigherPriorityTaskWoken )
   \{
    // Actual macro used here is port specific.
    portYIELD\_FROM\_ISR ();
   \}
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueGenericSendFromISR(                                        QueueHandle\_t        xQueue,                                        const    void    *pvItemToQueue,                                        BaseType\_t   *pxHigherPriorityTaskWoken,                                        BaseType\_t   xCopyPosition                                    );
\end{DoxyPre}


It is preferred that the macros x\+Queue\+Send\+From\+ISR(), x\+Queue\+Send\+To\+Front\+From\+ISR() and x\+Queue\+Send\+To\+Back\+From\+ISR() be used in place of calling this function directly. x\+Queue\+Give\+From\+ISR() is an equivalent for use by semaphores that don\textquotesingle{}t actually copy any data.

Post an item on a queue. It is safe to use this function from within an interrupt service routine.

Items are queued by copy not reference so it is preferable to only queue small items, especially when called from an ISR. In most cases it would be preferable to store a pointer to the item being queued.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em px\+Higher\+Priority\+Task\+Woken} & x\+Queue\+Generic\+Send\+From\+ISR() will set \texorpdfstring{$\ast$}{*}px\+Higher\+Priority\+Task\+Woken to pd\+TRUE if sending to the queue caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If x\+Queue\+Generic\+Send\+From\+ISR() sets this value to pd\+TRUE then a context switch should be requested before the interrupt is exited.\\
\hline
{\em x\+Copy\+Position} & Can take the value queue\+SEND\+\_\+\+TO\+\_\+\+BACK to place the item at the back of the queue, or queue\+SEND\+\_\+\+TO\+\_\+\+FRONT to place the item at the front of the queue (for high priority messages).\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the data was successfully sent to the queue, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage for buffered IO (where the ISR can obtain more than one value per call)\+: 
\begin{DoxyPre}
void vBufferISR( void )
\{
char cIn;
BaseType\_t xHigherPriorityTaskWokenByPost;

   // We have not woken a task at the start of the ISR.
   xHigherPriorityTaskWokenByPost = pdFALSE;

   // Loop until the buffer is empty.
   do
   \{
    // Obtain a byte from the buffer.
    cIn = portINPUT\_BYTE( RX\_REGISTER\_ADDRESS );

    // Post each byte.
    xQueueGenericSendFromISR( xRxQueue, \&cIn, \&xHigherPriorityTaskWokenByPost, queueSEND\_TO\_BACK );

   \} while( portINPUT\_BYTE( BUFFER\_COUNT ) );

   // Now the buffer is empty we can switch context if necessary.  Note that the
   // name of the yield function required is port specific.
   if( xHigherPriorityTaskWokenByPost )
   \{
    portYIELD\_FROM\_ISR();
   \}
\}
\end{DoxyPre}
 